package model

import (
	"context"
	"service/ctrl"
	"service/model/mod"

	gpb "gitee.com/cloudapex/protos/hr/pb"

	"google.golang.org/grpc"
)

var Framework framework

func init() {
	ctrl.GCon.RegistClienter(mod.GCONN_HR, func(c *grpc.ClientConn) {
		Framework.cli = gpb.NewFrameworkClient(c)
		Framework.css = gpb.NewStaffServerClient(c)
	})
}

type framework struct {
	cli gpb.FrameworkClient
	css gpb.StaffServerClient
}

// framework.AddFramework 组织架构添加
func (this *framework) AddFramework(ctx context.Context, in *gpb.FrameworkReq) (*gpb.FrameworkRes, error) {
	return this.cli.AddFramework(ctx, in)
}

// framework.DelFramework 组织架构添加
func (this *framework) DelFramework(ctx context.Context, in *gpb.FrameworkReq) (*gpb.FrameworkRes, error) {
	return this.cli.DelFramework(ctx, in)
}

// framework.GetFrameList 获取当前组织下的子类
func (this *framework) GetFrameList(ctx context.Context, in *gpb.FrameworkReq) (*gpb.GetFrameRes, error) {
	return this.cli.GetFrameList(ctx, in)
}

// framework.GetFramework 查询当前架构信息
func (this *framework) GetFramework(ctx context.Context, in *gpb.FrameworkReq) (*gpb.FrameworkRes, error) {
	return this.cli.GetFramework(ctx, in)
}

// framework.OrderFramework 组织架构上下移动
func (this *framework) OrderFramework(ctx context.Context, in *gpb.SwitchReq) (*gpb.FrameworkRes, error) {
	return this.cli.OrderFramework(ctx, in)
}

// framework.EditFramework 修改组织架构名称
func (this *framework) EditFramework(ctx context.Context, in *gpb.FrameworkReq) (*gpb.FrameworkRes, error) {
	return this.cli.EditFramework(ctx, in)
}

// framework.ChangeUserFrame 更换组织架构信息
func (this *framework) ChangeUserFrame(ctx context.Context, in *gpb.StaffEditReq) (*gpb.StaffEditRes, error) {
	return this.css.ChangeUserFrame(ctx, in)
}

// framework.AddChangeFramRole 更换组织架构信息添加 修改 记录
func (this *framework) AddChangeFramRole(ctx context.Context, in *gpb.ChangeFraRoleReq) (*gpb.BaseRes, error) {
	return this.css.AddChangeFramRole(ctx, in)
}

// framework.ChangeFramRoleList 更换组织架构信息添加 修改 记录
func (this *framework) ChangeFramRoleList(ctx context.Context, in *gpb.ChangeListReq) (*gpb.ChangeFraRoleRes, error) {
	return this.css.ChangeFramRoleList(ctx, in)
}
